let timer;
Component({
  properties: {
    historyOpt: {
      type: Object
    },
    title: {
      type: String
    },
    showLoad: {
      type: Boolean,
      default: false
    },
    isCount: {
      type: Boolean,
      default: false
    }
  },

  data: {
    curSelect: null,
    isSelect: false,
    addBorder: false,
    curIndex: 0,
  },
  pageLifetimes: {
    
  },
  methods: {
    // 显示下拉菜单
    selectList(){
      let isSelect = !this.data.isSelect;
      this.setData({
        isSelect
      })
      clearTimeout(timer)

      timer = setTimeout(()=> {
        this.setData({
          isSelect: false
        })
        clearTimeout(timer)
      }, 1500)
      // setTimeout(() => {
      //   this.setData({
      //     addBorder: !isSelect
      //   })
      // }, 100)
    },

    // 选择框
    selectItem(e) {
      let dataset = e.currentTarget.dataset;
      this.selectList();
      if (this.data.curIndex === dataset.index) return;
      this.setData({
        curSelect: dataset.item,
        curIndex: dataset.index
      })
      this.triggerEvent('myevent', {
        curOpt: dataset.item, 
        index: dataset.index
      })
    },

    // 统计选项触发
    setTimeOpt(){
      this.setData({
        curIndex: 0
      })
    }
  }
})